package defpackage; import android.animation.Animator; import android.animation.ObjectAnimator; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.JsPromptResult; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.ProgressBar; import cn.wps.moffice.OfficeApp; import cn.wps.moffice.common.beans.OnResultActivity; import cn.wps.moffice.common.superwebview.KFileARChromeClient; import cn.wps.moffice.common.superwebview.PtrSuperWebView; import cn.wps.moffice.common.superwebview.WebviewErrorPage; import cn.wps.moffice.main.common.viewcontrols.ViewTitleBar; import cn.wps.moffice.main.framework.BaseTitleActivity; import cn.wps.moffice.main.push.common.JSCustomInvoke; import cn.wps.moffice_eng.R; import defpackage.cqh; import defpackage.hqw; /* renamed from: hbf reason: default package */ public class hbf extends fyq { private String cjY; public JSCustomInvoke.a hDh = null; public String hRl; public long hRm; public long hRn = -1; public boolean hRo = false; public boolean hRp = false; public dhp hTl; b hTm; private Button hTn = ((Button) getMainView().findViewById(R.id.turn_to_activity)); private gto hTo; public hqw.a hTp; private boolean hTq = false; public boolean hTr = false; public boolean hTs = true; public boolean hTt = true; private boolean hTu = false; private eft hTv; private WebViewClient hTw; private ProgressBar hkZ = this.mPtrSuperWebView.eFN; private gtn hss; private boolean isFirst = true; public PtrSuperWebView mPtrSuperWebView = ((PtrSuperWebView) getMainView().findViewById(R.id.push_tips_ptr_super_webview)); public View mView; public WebView mWebView = this.mPtrSuperWebView.mWebView; /* renamed from: hbf$a */ class a extends hac { public a(Activity activity, PtrSuperWebView ptrSuperWebView) { super(activity, ptrSuperWebView); } @Override // cn.wps.moffice.main.push.common.JSCustomInvoke.c, defpackage.hac public final void bXD() { super.bXD(); try { View rootView = hbf.this.mWebView.getRootView(); final View findViewById = rootView.findViewById(R.id.view_title_lay); if (findViewById.getVisibility() == 0) { final ObjectAnimator ofInt = ObjectAnimator.ofInt(rootView, "Top", 0, -findViewById.getMeasuredHeight()); ofInt.setDuration(300L); ofInt.addListener(new Animator.AnimatorListener() { /* class defpackage.hbf.a.AnonymousClass1 */ public final void onAnimationCancel(Animator animator) { } public final void onAnimationEnd(Animator animator) { findViewById.setVisibility(8); luf.bN(hbf.this.mActivity); } public final void onAnimationRepeat(Animator animator) { } public final void onAnimationStart(Animator animator) { } }); luf.bA(hbf.this.mActivity); fzc.bJM().c(new Runnable() { /* class defpackage.hbf.a.AnonymousClass2 */ public final void run() { ofInt.start(); } }, 500); } } catch (Exception e) { e.printStackTrace(); } } @Override // cn.wps.moffice.main.push.common.JSCustomInvoke.c, defpackage.hac public final void m(String str, String str2, String str3, String str4) { hbf.a(hbf.this, str, str2, str3, str4); hbf.this.cjY = str; if (!TextUtils.isEmpty(hbf.this.cjY)) { hbf.c(hbf.this, "public_activity_share_" + hbf.this.cjY); } } @Override // cn.wps.moffice.main.push.common.JSCustomInvoke.c, defpackage.hac public final void setShareParams(String str, String str2, String str3, String str4) { super.setShareParams(str, str2, str3, str4); if (hbf.this.hTp != null) { hbf.this.hTp.Bb(str).Be(str4).Bf(str3).Bd(str2); } } } /* renamed from: hbf$b */ public interface b { void aNy(); void aNz(); void bXT(); } /* access modifiers changed from: package-private */ /* renamed from: hbf$c */ public class c implements gtj { c() { } @Override // defpackage.gtj public final void onShareCancel() { hbf.y(hbf.this); } @Override // defpackage.gtj public final void onShareSuccess() { if (!hbf.this.hTq) { lvg.d(hbf.this.mActivity, R.string.public_share_success, 0); } hbf.x(hbf.this); if (!TextUtils.isEmpty(hbf.this.cjY)) { hbf.c(hbf.this, "public_share_weibo_" + hbf.this.cjY); } } } /* access modifiers changed from: package-private */ /* renamed from: hbf$d */ public class d implements gtj { d() { } @Override // defpackage.gtj public final void onShareCancel() { hbf.y(hbf.this); } @Override // defpackage.gtj public final void onShareSuccess() { if (!hbf.this.hTq) { lvg.d(hbf.this.mActivity, R.string.public_share_success, 0); } hbf.x(hbf.this); if (!TextUtils.isEmpty(hbf.this.cjY)) { hbf.c(hbf.this, "public_share_wechat_" + hbf.this.cjY); } } } public hbf(Activity activity) { super(activity); ebj.c(this.mWebView); this.mWebView.setScrollBarStyle(33554432); AnonymousClass1 r1 = new KFileARChromeClient(this.mActivity, null, this.mPtrSuperWebView) { /* class defpackage.hbf.AnonymousClass1 */ public final boolean onJsPrompt(WebView webView, String str, String str2, String str3, JsPromptResult jsPromptResult) { return (hbf.this.hTv != null ? hbf.this.hTv.aWC() : false) || super.onJsPrompt(webView, str, str2, str3, jsPromptResult); } @Override // defpackage.edq public final void onProgressChanged(WebView webView, int i) { if (i > 50 && hbf.this.isFirst) { if (!hbf.this.hTu) { if (hbf.this.hTr) { hbf.this.getTitleBar().gBF.setVisibility(8); } else if (hbf.this.hTq) { hbf.this.getTitleBar().gBF.setVisibility(8); } hbf.this.isFirst = false; } hbf.this.getTitleBar().gBF.setVisibility(0); hbf.this.isFirst = false; } super.onProgressChanged(webView, i); } public final void onReceivedTitle(WebView webView, String str) { super.onReceivedTitle(webView, str); Intent intent = hbf.this.mActivity.getIntent(); if (intent != null && intent.getExtras() != null && intent.getExtras().getBoolean("KEY_USEWEBTITLE", true)) { hbf.this.getTitleBar().setTitleText(str); } } }; if (this.mActivity instanceof OnResultActivity) { ((OnResultActivity) this.mActivity).setOnHandleActivityResultListener(r1); } this.mWebView.setWebChromeClient(r1); getTitleBar().gBF.setVisibility(8); this.hTw = new edr() { /* class defpackage.hbf.AnonymousClass2 */ @Override // defpackage.edr public final void a(WebviewErrorPage webviewErrorPage) { hbf.this.getTitleBar().gBF.setVisibility(8); hbf.this.isFirst = true; if (hbf.this.hTm != null) { hbf.this.hTm.aNz(); } if (!hai.dS(hbf.this.getActivity())) { webviewErrorPage.cNE.setText(R.string.documentmanager_cloudfile_no_network); hbf.this.getTitleBar().setTitleText(R.string.documentmanager_cloudfile_no_network); } else { webviewErrorPage.cNE.setText(hbf.this.getActivity().getResources().getString(R.string.public_error_content)); hbf.this.getTitleBar().setTitleText(R.string.public_error); } if (eix.UILanguage_chinese == eip.eSn) { webviewErrorPage.ru(8); } else { webviewErrorPage.ru(0); } } @Override // defpackage.edr public final PtrSuperWebView getPtrSuperWebView() { return hbf.this.mPtrSuperWebView; } @Override // defpackage.edr public final void onPageFinished(WebView webView, String str) { super.onPageFinished(webView, str); if (!hbf.this.hRo && "onPageStarted".equals(hbf.this.hRl)) { hbf.this.hRo = true; hbf.this.hRl = "onPageFinished"; hbf.this.hRn = System.currentTimeMillis() - hbf.this.hRm; } hbf.l(hbf.this); if (hbf.this.hTm != null) { hbf.this.hTm.bXT(); } if (hbf.this.hTp != null) { hbf.this.hTp.Bb(webView.getTitle()); } } @Override // defpackage.edr public final void onPageStarted(WebView webView, String str, Bitmap bitmap) { super.onPageStarted(webView, str, bitmap); if (TextUtils.isEmpty(hbf.this.hRl)) { hbf.this.hRl = "onPageStarted"; hbf.this.hRm = System.currentTimeMillis(); } if (hbf.this.hTm != null) { hbf.this.hTm.aNy(); } } @Override // defpackage.edr public final void onReceivedError(WebView webView, int i, String str, String str2) { super.onReceivedError(webView, i, str, str2); if (!hbf.this.hRo) { hbf.this.hRl = "onReceivedError"; } } @Override // defpackage.edr, android.webkit.WebViewClient public final boolean shouldOverrideUrlLoading(WebView webView, String str) { if (str.startsWith("mailto:")) { try { Intent intent = new Intent("android.intent.action.SENDTO"); intent.setData(Uri.parse(str)); webView.getContext().startActivity(intent); return true; } catch (Exception e) { return true; } } else if (str.equals("http://wps.com/pc.install/") || str.equals("https://wps.com/pc.install/")) { hbf.this.mActivity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str))); return true; } else if (hbf.this.hTv != null && hbf.this.hTv.aWB()) { return true; } else { if (str.toLowerCase().startsWith("http:") || str.toLowerCase().startsWith("https:")) { return false; } if (hfj.bs(hbf.this.mActivity, str) || !hbf.this.hTs) { return true; } try { hbf.this.mActivity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str))); if (hbf.this.hRo) { return true; } hbf.this.hRl = "shouldOverrideUrlLoading Intent.ACTION_VIEW"; return true; } catch (Exception e2) { return true; } } } }; this.mWebView.setWebViewClient(this.hTw); this.hTl = new dhp(this.mActivity); this.mWebView.setDownloadListener(this.hTl); JSCustomInvoke jSCustomInvoke = new JSCustomInvoke(); jSCustomInvoke.setJsCallback(new a(this.mActivity, this.mPtrSuperWebView)); this.hDh = jSCustomInvoke.getJSCustomInvokeListener(); this.mWebView.addJavascriptInterface(jSCustomInvoke, "splash"); this.mWebView.addJavascriptInterface(jSCustomInvoke, "qing"); this.hTp = new hqw.a(activity); } static /* synthetic */ void a(hbf hbf, String str, String str2, String str3, String str4) { hbf.bXP().setTitle(str); hbf.bXP().setUrl(str2); hbf.bXP().icon = str3; hbf.bXQ().setTitle(str4); if (hbf.hTq) { new gtm(hbf.mActivity, hbf.bXP(), hbf.bXQ()).show(); } else { hbf.hTp.Bb(str).Bf(str2).cjx().a(hbf.bXP(), hbf.bXQ()); } } private gto bXQ() { if (this.hTo == null) { this.hTo = new gto(this.mActivity); this.hTo.setShareCallback(new c()); } return this.hTo; } static /* synthetic */ void c(hbf hbf, String str) { OfficeApp.arx().arB(); cqh.c ask = cqr.ask(); ask.cpH = "UA-31928688-36"; ask.cpI = false; OfficeApp.arx().arN(); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private ViewTitleBar getTitleBar() { return ((BaseTitleActivity) this.mActivity).getTitleBar(); } static /* synthetic */ void l(hbf hbf) { hbf.mActivity.runOnUiThread(new Runnable() { /* class defpackage.hbf.AnonymousClass4 */ public final void run() { hbf.this.mWebView.loadUrl("javascript:jsWpsApp()"); } }); } static /* synthetic */ void x(hbf hbf) { hbf.mActivity.runOnUiThread(new Runnable() { /* class defpackage.hbf.AnonymousClass3 */ public final void run() { hbf.this.mWebView.loadUrl("javascript:goOtherPage()"); } }); cqn arn = cqn.arn(); arn.arp(); if (arn.cpX != null) { arn.cpX.art(); } } static /* synthetic */ void y(hbf hbf) { if (hbf.hTq) { lvg.a(hbf.mActivity, "分享后才能参与活动哦", 1); } } public final gtn bXP() { if (this.hss == null) { this.hss = new gtn(this.mActivity); this.hss.callback = new d(); } return this.hss; } public final Button bXR() { if (this.hTn == null) { this.hTn = (Button) getMainView().findViewById(R.id.turn_to_activity); } return this.hTn; } public final boolean bXS() { if (this.hDh != null && this.hDh.bXv()) { return true; } if (!this.mWebView.canGoBack()) { return false; } this.mWebView.goBack(); return true; } public final void cJ(String str, String str2) { if (this.hTv == null) { try { this.hTv = (eft) cwi.a(!ltk.iTs ? ltv.getInstance().getExternalLibsClassLoader() : hbf.class.getClassLoader(), "cn.wps.moffice.common.titlebarad.impl.TBHelper", null, new Object[0]); if (this.mActivity instanceof OnResultActivity) { ((OnResultActivity) this.mActivity).setOnHandleActivityResultListener(this.hTv); } } catch (Exception e) { e.printStackTrace(); loadUrl(str); } } } @Override // defpackage.fys, defpackage.fyq public View getMainView() { if (this.mView == null) { this.mView = LayoutInflater.from(getActivity()).inflate(R.layout.phone_public_push_tips_view, (ViewGroup) null); this.mView = (ViewGroup) lvw.co(this.mView); } return this.mView; } @Override // defpackage.fyq public int getViewTitleResId() { return eip.eSn == eix.UILanguage_chinese ? R.string.public_frequent_title : R.string.public_help_title; } public final void loadUrl(String str) { ebj.mK(str); this.mWebView.loadUrl(str); } }